<template>
  <div class="pro-table">
    <table>
      <thead>
        <tr>
          <th v-for="c in columns" :key="c.dataKey">{{ c.title }}</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(it, index) in datasource" :key="index">
          <td v-for="c in columns" :key="c.dataKey + index">
            {{ it[c.dataKey] }}
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script lang="ts" setup>
interface Props {
  columns: {
    title: string;
    dataKey: string;
  }[];
  datasource: any[];
}
defineProps<Props>();
</script>
